<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>机构端</title>
        <script src="/Public/static/jquery-2.0.3.min.js"></script>
        <script src="/Public/static/layer/layer.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
    </head>
    
    <body class="login_box contentBox pos_rel">
                
            <!-- 1.登录页文字部分 -->
            <div class="words pos_abs">
                <label for="" class="title pos_rel">欢迎来到<br>云销科技机构平台</label>
                <div class="accountPassword dpflxc">
                    <label for="" class="apTitle" >账号/用户名</label>
                    <input type="text" id="aa">
                </div>
                <div class="accountPassword dpflxc">
                    <label for="" class="apTitle" >账号/用户名</label>
                    <input type="password" id="bb">
                </div>
                <a onclick="login()" class="loginBtn">登录</a>
            </div>
            
            
            <!-- 2.版权申明 -->
            <label class="copyright pos_abs">COPYRIGHT © 2021 云销科技版权所有  湘ICP备 2312414-号</label>
    </body>


    <script>
    function login(){
        var mobile = $("#aa").val();
        var password = $('#bb').val();

        var url = "{:U('Login')}";
        $.ajax({
            type: "POST", //类型get，post
            url: url, //链接地址
            data:{"phone":mobile,"password":password},//参数，一般post用
            success: function(data){
                var dataObj = JSON.parse(data);
                console.log(dataObj.result);
                //成功后函数
                if(dataObj.result == 1){
                    setTimeout(function (){
                        window.location.href = "{:U('Home/Mechanism/index')}";
                    },1000);
                }else{
                    layer.msg('失败');
                }
            },
            error:function(){
                //失败时函数
                layer.msg("失败");
            }
        })
    }

    $(document).keyup(function(event){
        if(event.keyCode==13){
            login();
        }
    });
</script>
</html>
